//创建连接对象
if (window.XMLHttpRequest){
    var request = new XMLHttpRequest();//创建ajax链接对象
}
else if (window.ActiveXObject){
    var request = new ActiveXObject();
}

//连接获取到php传回的文本
function link(){
    if (request.readyState == 4 && request.status == 200) {
        document.getElementById("news").innerHTML = request.responseText;
    }
}

// function changePage(page){
//     if (request != null){
//         request.onreadystatechange = link;
//         request.open("GET","AllNewsInIndex.php",true)
//         request.send();
//     }
// }

//通过两个不同的函数传入type不同值来进行分支判断 在PersonalDo.php中
function showNews(page) {
    if (request != null){
        request.onreadystatechange = link;
        request.open("GET","AllNewsInIndex.php?page="+page,true)
        request.send();
    }
}
function showNews2(page) {
    if (request != null){
        request.onreadystatechange = link;
        request.open("GET","HitNewsIndex.php?page="+page,true)
        request.send();
    }
}
function showNews3(page) {
    if (request != null){
        request.onreadystatechange = link;
        request.open("GET","PZnewsIndex.php?page="+page,true)
        request.send();
    }
}
function showNews4(page) {
    if (request != null){
        request.onreadystatechange = link;
        request.open("GET","RiseNews.php?page="+page,true)
        request.send();
    }
}